<script src="<?php echo base_url(); ?>/js/holder.js"></script>
<style>
    .nav-tabs {
        margin-bottom: 20px;
    }
    .img-rounded {
        margin-bottom: 20px;
    }
    .col-sm-4 {
        margin-left: 20px;
    }
    .col-sm-6 {
        margin-left: -40px;
    }    
    .col-sm-8 {
        margin-left: -40px;
    }

</style>

<h3>Hồ sơ cá nhân</h3>
<div class="tabbable">
    <ul class="nav nav-tabs">
        <li class="active"><a href="#pane1" data-toggle="tab">Hồ sơ</a></li>
        <li><a href="#pane2" data-toggle="tab">Hoạt động</a></li>
        <li><a href="#pane3" data-toggle="tab">Đánh giá</a></li>
        <li><a href="#pane4" data-toggle="tab">Thông báo</a></li>
    </ul>
    <div class="tab-content">
        <div id="pane1" class="tab-pane active">
            <div class="panel panel-info " id="">
                <div class="panel-body">
                    <div class="col-md-4 column">
                        <img src="<?php echo base_url(); ?>/js/holder.js/140x140/sky" alt="..." class="img-rounded">            
                    </div>
                    <div class="col-md-5 column">
                        <div class="row">
                            <label class="control-label" for="is7s">
                                <?php
                                if ($query['is7s'] == 0) {
                                    echo 'Hiện tại chưa là gia sư 7s';
                                } else if ($query['is7s'] == 1) {
                                    echo 'Hiện đang là gia sư 7s';
                                }
                                ?>
                            </label>
                        </div>
                        <div class="row">
                            <label class="control-label" for="status">Trạng thái:</label>
                            <?php
                            if ($query['trangthai_id'] == 1) {
                                echo 'Chưa kích hoạt';
                            } else if ($query['trangthai_id'] == 2) {
                                echo 'Đã kích hoạt';
                            }
                            ?>
                        </div>
                    </div>
                    <div class="col-md-3 column">
                        <?php
                        //echo form_open('thanhvien/thanhvien/loadProfile/' . $query['id']);
                        ?>
                        <!-- <input type="submit" class="btn btn-success" value="Cập nhật" />-->
                        <?php
                        //echo form_close();
                        if ($query['is7s'] == 0) {
                            echo form_open('thanhvien/thanhvien/upgradeProfile/' . $query['id']);
                            ?>
                            <br>
                            <button type="submit" class="btn btn-danger">
                                Đăng ký 7s
                            </button>
                            <?php
                            echo form_close();
                        }
                        ?>
                    </div>
                </div>
            </div>

            <div class="panel panel-info " id=""> <!--panel Thông tin cá nhân-->
                <div class="panel-heading">
                    <h3 class="panel-title">Thông tin cá nhân</h3>
                </div>
                
                <div class="panel-body"> <!--panel body-->
                    
                    <div class="col-md-9 column"> <!-- leftside -->
                        <div class="form-group row">
                            <div class="col-sm-4">
                                <label class="control-label" for="display_name">Họ tên:</label>
                            </div>
                            <div class="col-sm-6">
                                <?php
                                
                                    if ($query['tenhienthi'] == '' || $query['tenhienthi'] == '0')
                                    {
                                        echo '<div class="text-muted"><i>Thông tin đang chờ cập nhật</i></div>';                                        
                                    }
                                    else
                                    {
                                        echo $query['tenhienthi'];
                                    }
                                ?>
                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col-sm-4">
                                <label class="control-label" for="sexual">Giới tính:</label>
                            </div>
                            <div class="col-sm-6">
                                <?php
                                
                                if ($query['gioitinh'] == 0) {
                                    echo 'Nam';
                                } else if ($query['gioitinh'] == 1) {
                                    echo 'Nữ';
                                } else {
                                    echo 'Không xác định';
                                }
                                ?>
                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col-sm-4">
                                <label class="control-label" for="email">Email:</label>
                            </div>
                            <div class="col-sm-6">
                                <?php  echo $query['email']; ?>
                      
                                       
                                                               
                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col-sm-4">
                                <label class="control-label" for="phone">Số điện thoại:</label>
                            </div>
                            <div class="col-sm-6">
                                
                                <?php
                                    if ($query['sodienthoai'] == '' || $query['sodienthoai'] == '0')
                                    {
                                        echo '<div class="text-muted"><i>Thông tin đang chờ cập nhật</i></div>';                                         
                                    }
                                    else
                                    {
                                        echo $query['sodienthoai'];
                                    }
                                ?>
                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col-sm-4">
                                <label class="control-label" for="address">Địa chỉ:</label>
                            </div>
                            <div class="col-sm-6">
                                
                                 <?php
                                    if ($query['diachi'] == '' || $query['diachi'] == '0')
                                    {
                                        echo '<div class="text-muted"><i>Thông tin đang chờ cập nhật</i></div>';                                         
                                    }
                                    else
                                    {
                                        echo $query['diachi'];
                                    }
                                ?>
                            </div>
                        </div>
                    
                   </div> <!-- end leftside -->
                    
                    <div class="col-md-3 column"> <!-- rightside -->
                                         
                        
                        <?php
                            echo $this->load->view('user/thanhvien/modal_update_profile');
                        ?>                  
                        <button id="edit" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">Cập nhật</button>
                        
                    </div>  <!-- end rightside -->
                </div> <!--end panel body-->
            </div> <!--end panel Thông tin cá nhân-->
            
            <div class="panel panel-info" id="" style="height:550px;">
                <div class="panel-heading">
                    <h3 class="panel-title">Địa chỉ</h3>
                </div>
            
                <div class="col-xs-10" >
                    
                    <?php
                                        
                    if ($diachi['tinhthanh'] != 0 || $diachi['quanhuyen'] != 0 || $diachi['xaphuong'] != 0 || $diachi['diachi'] != 0 ) {
                        
                        echo $map['headerjs'];
                        echo $map['headermap']; 
                        echo $map['onload'];
                        echo $map['map'];
                        echo $map['sidebar'];
                    } 
                    else if ($diachi['tinhthanh'] != '0' || $diachi['quanhuyen'] != '0' || $diachi['xaphuong'] != '0' || $diachi['diachi'] != '0' ) {
                        echo '<p>
                            <iframe width="510" height="510" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=vi&amp;geocode=&amp;q=59+%C4%91%C6%B0%E1%BB%9Dng+s%E1%BB%91+13,+khu+ph%E1%BB%91+1,+ph%C6%B0%E1%BB%9Dng+Linh+T%C3%A2y-Th%E1%BB%A7+%C4%90%E1%BB%A9c-TP.HCM.&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=0.010291,0.021136&amp;ie=UTF8&amp;hq=&amp;hnear=59+%C4%90%C6%B0%E1%BB%9Dng+S%E1%BB%91+5,+Linh+Chi%E1%BB%83u,+Thu+Duc+District,+Ho+Chi+Minh+City,+Vi%E1%BB%87t+Nam&amp;ll=10.852937,106.768398&amp;spn=0.006333,0.010568&amp;t=m&amp;z=14&amp;output=embed"></iframe><br />
                            <small>
                                <a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=vi&amp;geocode=&amp;q=59+%C4%91%C6%B0%E1%BB%9Dng+s%E1%BB%91+13,+khu+ph%E1%BB%91+1,+ph%C6%B0%E1%BB%9Dng+Linh+T%C3%A2y-Th%E1%BB%A7+%C4%90%E1%BB%A9c-TP.HCM.&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=0.010291,0.021136&amp;ie=UTF8&amp;hq=&amp;hnear=59+%C4%90%C6%B0%E1%BB%9Dng+S%E1%BB%91+5,+Linh+Chi%E1%BB%83u,+Thu+Duc+District,+Ho+Chi+Minh+City,+Vi%E1%BB%87t+Nam&amp;ll=10.852937,106.768398&amp;spn=0.006333,0.010568&amp;t=m&amp;z=14" style="color:#0000FF;text-align:left"></a>
                            </small>
                        </p>';
                        echo '<div class="text"><i>Thông tin đang chờ cập nhật</i></div>';
                    }
                    else if ($diachi['tinhthanh'] == '0' || $diachi['quanhuyen'] == '0' || $diachi['xaphuong'] == '0' || $diachi['diachi'] == '0' ) {
                        echo '<p>
                            <iframe width="510" height="510" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=vi&amp;geocode=&amp;q=59+%C4%91%C6%B0%E1%BB%9Dng+s%E1%BB%91+13,+khu+ph%E1%BB%91+1,+ph%C6%B0%E1%BB%9Dng+Linh+T%C3%A2y-Th%E1%BB%A7+%C4%90%E1%BB%A9c-TP.HCM.&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=0.010291,0.021136&amp;ie=UTF8&amp;hq=&amp;hnear=59+%C4%90%C6%B0%E1%BB%9Dng+S%E1%BB%91+5,+Linh+Chi%E1%BB%83u,+Thu+Duc+District,+Ho+Chi+Minh+City,+Vi%E1%BB%87t+Nam&amp;ll=10.852937,106.768398&amp;spn=0.006333,0.010568&amp;t=m&amp;z=14&amp;output=embed"></iframe><br />
                            <small>
                                <a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=vi&amp;geocode=&amp;q=59+%C4%91%C6%B0%E1%BB%9Dng+s%E1%BB%91+13,+khu+ph%E1%BB%91+1,+ph%C6%B0%E1%BB%9Dng+Linh+T%C3%A2y-Th%E1%BB%A7+%C4%90%E1%BB%A9c-TP.HCM.&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=0.010291,0.021136&amp;ie=UTF8&amp;hq=&amp;hnear=59+%C4%90%C6%B0%E1%BB%9Dng+S%E1%BB%91+5,+Linh+Chi%E1%BB%83u,+Thu+Duc+District,+Ho+Chi+Minh+City,+Vi%E1%BB%87t+Nam&amp;ll=10.852937,106.768398&amp;spn=0.006333,0.010568&amp;t=m&amp;z=14" style="color:#0000FF;text-align:left"></a>
                            </small>
                        </p>';
                        echo $map_gs['info'];
                         
                        
                    } 
                    else {
                        echo '<p>
                            <iframe width="510" height="510" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=vi&amp;geocode=&amp;q=59+%C4%91%C6%B0%E1%BB%9Dng+s%E1%BB%91+13,+khu+ph%E1%BB%91+1,+ph%C6%B0%E1%BB%9Dng+Linh+T%C3%A2y-Th%E1%BB%A7+%C4%90%E1%BB%A9c-TP.HCM.&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=0.010291,0.021136&amp;ie=UTF8&amp;hq=&amp;hnear=59+%C4%90%C6%B0%E1%BB%9Dng+S%E1%BB%91+5,+Linh+Chi%E1%BB%83u,+Thu+Duc+District,+Ho+Chi+Minh+City,+Vi%E1%BB%87t+Nam&amp;ll=10.852937,106.768398&amp;spn=0.006333,0.010568&amp;t=m&amp;z=14&amp;output=embed"></iframe><br />
                            <small>
                                <a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=vi&amp;geocode=&amp;q=59+%C4%91%C6%B0%E1%BB%9Dng+s%E1%BB%91+13,+khu+ph%E1%BB%91+1,+ph%C6%B0%E1%BB%9Dng+Linh+T%C3%A2y-Th%E1%BB%A7+%C4%90%E1%BB%A9c-TP.HCM.&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=0.010291,0.021136&amp;ie=UTF8&amp;hq=&amp;hnear=59+%C4%90%C6%B0%E1%BB%9Dng+S%E1%BB%91+5,+Linh+Chi%E1%BB%83u,+Thu+Duc+District,+Ho+Chi+Minh+City,+Vi%E1%BB%87t+Nam&amp;ll=10.852937,106.768398&amp;spn=0.006333,0.010568&amp;t=m&amp;z=14" style="color:#0000FF;text-align:left"></a>
                            </small>
                        </p>';
                        echo $map_gs['info'];                                        
                    }
                    
                    ?>
                </div>
                <div class="col-xs-1" style="height:200px; margin-top: 250px;">
                    
                    <?php
                            echo $this->load->view('user/thanhvien/home_diachi_view');
                            
                    ?>                  
                        <button id="edit" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Cập nhật</button>
                        
                       
                </div>
            </div>
        </div>
        <div id="pane2" class="tab-pane">
            <div class="row">
                <div class="col-md-6 text text-success text-center"><h4><strong>Hoạt động gia sư</strong></h4></div>
                <div class="col-md-6 text text-danger text-center"><h4><strong>Hoạt động phụ huynh</strong></h4></div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <?php echo form_open('giaodich/becometutor/index/' . $query['id']); ?>
                    <button type="submit" class="btn btn-success btn-block">Làm gia sư</button>
                    <?php echo form_close(); ?>
                </div>
                <div class="col-md-6">
                    <?php echo form_open('giaodich/seektutor/index/' . $query['id']); ?>
                    <button type="submit" class="btn btn-danger btn-block">Tạo lớp</button>
                    <?php echo form_close(); ?>
                </div>
            </div>
            <br>
            <div class="row">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="col-md-6">
                            <?php
                            foreach ($hoatdong_giasu as $tung_hoatdong_giasu) {
                                ?>
                                <div class="panel panel-default">
                                    <div class="panel-body">
                                        Mã lớp: <?php print_r('Gs7s-giasu-' . $tung_hoatdong_giasu['id']); ?><br>
                                        Trạng thái: 
                                        <?php
                                        if ($tung_hoatdong_giasu['LamGiaSu_TrangThai_id'] == 1)
                                            print_r("Đang chờ.");
                                        else
                                            print_r("Đã hoàn thành.");
                                        ?>
                                        <br>
                                        Mức lương: <?php print_r($tung_hoatdong_giasu['MucLuongYeuCau']); ?>
                                    </div>
                                </div>
                                <?php
                            }
                            ?>
                        </div>
                        <div class="col-md-6">
                            <?php
                            foreach ($hoatdong_phuhuynh as $tung_hoatdong_phuhuynh) {
                                ?>
                                <div class="panel panel-default">
                                    <div class="panel-body">
                                        Mã lớp: <?php print_r('Gs7s-lop-' . $tung_hoatdong_phuhuynh['id']); ?><br>
                                        Trang thái: 
                                        <?php
                                        if ($tung_hoatdong_phuhuynh['TimGiaSu_TrangThai_id'] == 1)
                                            print_r("Đang chờ.");
                                        else
                                            print_r("Đã hoàn thành.");
                                        ?>
                                        <br>
                                        Học phí: <?php print_r($tung_hoatdong_phuhuynh['HocPhi']); ?>
                                    </div>
                                </div>
                                <?php
                            }
                            ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="pane3" class="tab-pane">
            <div class="panel panel-info tim-gia-su" id="">
                <div class="panel-heading">
                    <h3 class="panel-title">Thông Tin</h3>
                </div>
                <div class="panel-body row">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label for="" class="col-sm-4">Đánh Giá</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="danhgia2" placeholder="8/10">
                            </div>
                        </div>     
                        <div class="form-group">
                            <label for="" class="col-sm-4">Ý kiến</label>
                            <div class="col-sm-8">
                                <textarea class="form-control" rows="4" placeholder=" Nhận Xét"></textarea>

                            </div>
                        </div>  
                    </form>
                </div>
            </div>
        </div>
        <div id="pane4" class="tab-pane">
            <script>
                $(function() {
                   $("[data-toggle='tooltip']").tooltip();
                });
            </script>
            <div class="row">
                <div class="col-md-6 text text-success text-center"><h4><strong>Hoạt động gia sư</strong></h4></div>
                <div class="col-md-6 text text-danger text-center"><h4><strong>Hoạt động phụ huynh</strong></h4></div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <?php
                    $i = 0;
                    if ($thongbao_giasu['data'] != NULL) {
                       ?>
                        <ul class="nav nav-pills nav-stacked">
                            <?php
                            foreach ($thongbao_giasu['giasu_id'] as $value1) {
                               
                                if($value1['count'] != 0){
                                ?>
                                <li class="dropdown">
                                    <?php echo form_open('giaodich/display/display_lamgiasu_chitiet/' . $value1['id']); ?>
                                    <div class="btn-group col-md-12" style="padding:0px;margin-top:3px;">
                                        <button role="button" class="btn btn-default col-md-10" data-toggle="tooltip" data-placement="top" title="Chi tiết gia sư">
                                            Gia sư <b class="text-danger">gs7s-giasu-<?php echo $value1['id'] ?></b>
                                        </button>
                                        <?php echo form_close(); ?>
                                        <button type="button" class="btn btn-warning dropdown-toggle col-md-2" data-toggle="dropdown">
                                            <span class="badge"><?php echo $value1['count']; ?></span>
                                            <span class="caret" style="display:none;"></span>
                                        </button>
                                    <ul class="dropdown-menu col-md-12" role="menu" style="padding-top:0px">
                                        <li>
                                            <div class="panel panel-warning tim-gia-su">
                                                <div class="panel-heading">
                                                    <h5 class="panel-title text-center">Phụ huynh đăng ký</h5>
                                                </div>
                                            </div>
                                        </li>
                                        <?php
                                        foreach ($thongbao_giasu['data'] as $value2) {
                                            if ($value2['LamGiaSu_id'] == $value1['id']) {
                                                echo form_open('giaodich/giaodich/hoanthanh_chonlop/' . $value2['LamGiaSu_id'] . '/' . $value2['thanhvien_id']);
                                                ?>
                                                <li class="col-md-12 form-group">

                                                    <div class="col-md-8" style="padding:0px">Phụ huynh  <b class="text-danger"><?php echo $value2['tenhienthi'] ?></b></div>
                                                    <div class="col-md-4" style="padding:0px">
                                                        <button type="submit" class="btn btn-primary btn-sm pull-right" value=""> Lựa chọn</button>
                                                    </div>
                                                </li>
                                                <?php
                                                echo form_close();
                                            }
                                        }
                                        ?>
                                    </ul>
                                    </div>
                                </li>
                                <?php
                                }
                            }
                            ?>
                        </ul>
                        <?php
                    } else {
                        ?>
                        <div class="text-center">
                            <img src="<?php echo base_url(); ?>/image/clock.png" alt="..." height="100px" class="img-rounded">            
                        </div>
                        <?php
                        echo '<br>Hiện tại chưa có thông báo liên quan tới gia sư.';
                    }
                    ?>
                </div>
                <div class="col-md-6">

                    <?php
                    ?>


                    <?php
                    if ($thongbao_lop['data'] != NULL) {
                        ?>
                        <ul class="nav nav-pills nav-stacked">
                            <?php
                            foreach ($thongbao_lop['lop_id'] as $value1) {
                                 if($value1['count'] != 0){
                                ?>
                                <li class="dropdown">
                                    <?php echo form_open('giaodich/display/display_timgiasu_chitiet/' . $value1['id']); ?>
                                    <div class="btn-group col-md-12" style="padding:0px;margin-top:3px;">
                                        <button role="button" class="btn btn-default col-md-10" data-toggle="tooltip" data-placement="top" title="Chi tiết lớp học">
                                            Lớp học <b class="text-danger">gs7s-lop-<?php echo $value1['id'] ?></b>
                                        </button>
                                        <?php echo form_close(); ?>
                                        <button type="button" class="btn btn-warning dropdown-toggle col-md-2" data-toggle="dropdown">
                                            <span class="badge"><?php echo $value1['count']; ?></span>
                                        </button>
                                    <ul class="dropdown-menu col-md-12" role="menu" style="padding-top:0px">
                                        <li>
                                            <div class="panel panel-warning tim-gia-su">
                                                <div class="panel-heading">
                                                    <h5 class="panel-title text-center">Gia sư đăng ký</h5>
                                                </div>
                                            </div>
                                
                                        </li>
                                        <?php
                                        foreach ($thongbao_lop['data'] as $value2) {
                                            if ($value2['TimGiaSu_id'] == $value1['id']) {
                                                echo form_open('giaodich/giaodich/hoanthanh_chongiasu/' . $value2['TimGiaSu_id'] . '/' . $value2['thanhvien_id']);
                                                ?>
                                                <li class="col-md-12 form-group">
                                                    <div class="col-md-8" style="padding:0px">Gia sư  <b class="text-danger"><?php echo $value2['tenhienthi'] ?></b></div>
                                                    <div class="col-md-4" style="padding:0px">
                                                        <button type="submit" class="btn btn-primary btn-sm pull-right" value=""> Lựa chọn</button>
                                                    </div>
                                                </li>
                                                <?php
                                                echo form_close();
                                            }
                                        }
                                        ?>
                                    </ul>
                                    </div>
                                </li>
                                <?php
                            }
                            }
                            ?>
                        </ul>
                        <?php
                    } else {
                        ?>
                        <div class="text-center">
                            <img src="<?php echo base_url(); ?>/image/clock.png" alt="..." height="100px" class="img-rounded">            
                        </div>
                        <?php
                        echo '<br>Hiện tại chưa có thông báo liên quan tới việc mở lớp.';
                    }
                    ?>

                </div>
            </div>
        </div>
    </div>
</div>